package json;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import org.junit.Test;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class JsonTest
{
    public static void main(String[] args)
    {
        List<Student> students = new ArrayList<>();
        Student student1 = new Student("1", "11");
        Student student2 = new Student("2", "22");
        students.add(student1);
        students.add(student2);
        String s = JSON.toJSONString(students);
        System.out.println(s);
    }

    @Test
    public void test()
    {
//        Map<String,Point> map = new HashMap();
//        Point point= new Point();
//        Point point1 = new Point();
//        point.setX("112.9672");
//        point.setY("28.2792");
//        point1.setX("112.9564");
//        point1.setY("28.2735");
//        map.put("fromPoint", point);
//        map.put("toPoint", point1);
        Map<String, String> map = new HashMap<>();
        map.put("fromPoint", "112.2 23.4");
        map.put("toPoint", "111 22");

        String s = JSON.toJSONString(map);
        System.out.println(s);
    }
}
